API Reference
Functions
| Function | Signature | Purpose |
|---|---|---|
giftmeMakePayment | (req: GiftmePaymentRequest) → Promise<GiftmePaymentResponse> | Opens the native pay sheet for the order referenced by orderToken. |
giftmeGetAuthCode | (req: GiftmeAuthCodeRequest) → Promise<GiftmeAuthResponse> | Returns a one-time code that can be exchanged for an API access token. |
isMiniStoreContext | () → boolean | true when the page is loaded inside Giftme's WebView (navigator.userAgent contains giftme_webview). |
Request Objects
GiftmePaymentRequest
interface GiftmePaymentRequest {
/** Server-generated token that represents the order the user is about to pay for */
orderToken: string;
}
GiftmeAuthCodeRequest
interface GiftmeAuthCodeRequest {
/** The storefront identifier you received from Giftme */
miniStoreId: string;
}
Response Objects
GiftmeAuthResponse
The exact shape is defined by the native bridge and may change, but you can rely on at least:
type GiftmeAuthResponse =
| { status: 'SUCCESS'; payload: { status: string, message: string, token: string }}
| { status: 'CANCELLED'; payload: { message: string }} // Cancelled by user
| { status: 'ERROR'; payload: { message: string }};
GiftmePaymentResponse
The exact shape is defined by the native bridge and may change, but you can rely on at least:
type GiftmePaymentResponse =
| { status: 'SUCCESS'; payload: { ...data }}
| { status: 'CANCELLED'; payload: { message: string }} // Cancelled by user
| { status: 'ERROR'; payload: { message: string, ...data }};